package cn.xxstudy.permission.help

import android.content.Context
import android.content.pm.PackageManager
import androidx.core.content.ContextCompat
import androidx.fragment.app.FragmentActivity

/**
 * @author ：wuxinxi on 2020/11/10 .
 * @packages ：cn.xxstudy.permission.help .
 * TODO:Permission init
 */
class PermissionHelper {
    companion object {
        fun init(activity: FragmentActivity): PermissionCollection {
            return PermissionCollection(activity)
        }

        fun isGranted(context: Context, permission: String): Boolean {
            return ContextCompat.checkSelfPermission(context, permission) == PackageManager.PERMISSION_GRANTED
        }

    }
}